Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Basics Making Decisions in Your Code with Conditional Statements The Conditional Challenge

Jezz Rose
Jezz Rose
2,177 Points

Why do I have blank blue screen? Where is my quiz pop up?

When I preview the program I have no pop up coming up, just the blue screen. Have I missed something?

/*

  1. Store correct answers
    • When quiz begins, no answers are correct */ let points = '0';

// 2. Store the rank of a player let rank = '';

// 3. Select the <main> HTML element const main = document.querySelector("main");

/*

  1. Ask at least 5 questions
    • Store each answer in a variable
    • Keep track of the number of correct answers */ const answer1 = prompt("What is the capital of Romania?"); if ( answer1.toUpperCase() === 'BUCHAREST' ) { points += 1;

const answer2 = prompt("Who is the Prime Minister of Romania?"); if ( answer2.toUpperCase() === 'NICOLAE CIUCA' ) { points += 1;

const answer3 = prompt("How many years has Therme Bucharest been open?"); if ( answer3.toUpperCase() === 'SEVEN' ) { points += 1;

const answer4 = prompt("What is teh national animal of Romania?"); if ( answer4.toUpperCase() === 'EURASIAN LYNX' ) { points += 1;

const answer5 = prompt("Did you like this quiz?"); if ( answer5.toUpperCase() === 'YES' ) { points += 1;

/*

  1. Rank players award on number of correct answers
    • 5 correct = Gold
    • 3-4 correct = Silver
    • 1-2 correct = Bronze
    • 0 correct = No crown */

if ( points === 5 ) { rank = "Gold"; } else if ( points >= 3) { rank = "Silver"; } else if ( points >= 2) { rank = "Bronze"; } else { rank = "Poop ;P"; }

// 6. Output results to the <main> element main.innerHTML = <h2>You got ${points} out of 5 questions correct.</h2> <p>Award earned: <strong>${rank}</strong></p> ;

1 Answer

josephweiss2
josephweiss2
7,094 Points
  1. The points variable should not be this let points = '0'; it should be this let points = 0; without "".
  2. After each if(answer....) { your missing the closing ---> } <--- An if statment should look like this: if(this) { that } Try it out with fixing it and let me know if it fixed your game. Thanks
Jezz Rose
Jezz Rose
2,177 Points

Thanks! It's been a while so I'm very rusty!

josephweiss2
josephweiss2
7,094 Points

please if it helped you then push me up to make me earn points, Thanks